package com.linwen.javase.desgin_pattern.structure.composite;

/**
 * @ClassName CompositeTest
 * @Description
 * @Author lin
 * @Date 2022/6/21 下午11:06
 * @Version V1.0
 */
public class CompositeTest {
    public static void main(String[] args) {
        Composite composite = new Composite("大树");
        Composite composite1 = new Composite("一级树枝");
        composite.add(composite1);
        Leaf leaf1 = new Leaf("一级树叶");
        composite.add(leaf1);
        Leaf leaf2 = new Leaf("二级树叶");
        composite1.add(leaf2);
        composite.operate();
    }
}
